package com.jeesite.modules.config;

import com.thinkgem.jeesite.common.web.view.JstlView;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * Spring MVC 配置
 * @author ThinkGem
 * @version 2019-6-12
 */
@Configuration
@EnableWebMvc
public class JspViewConfig implements WebMvcConfigurer {

	@Override
	public void configureViewResolvers(ViewResolverRegistry registry) {
		// JSP 视图解析器（order越小优先级越高）
		InternalResourceViewResolver jspView = new InternalResourceViewResolver();
		jspView.setViewClass(JstlView.class);
		jspView.setPrefix("/WEB-INF/views/");
		jspView.setSuffix(".jsp");
		jspView.setOrder(1000);
		registry.viewResolver(jspView);
	}
}